package com.ruoyi.framework.config;

import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MilvusConfig {

    @Value("${milvus.uri}")
    private String uri;

    @Value("${milvus.token}")
    private String token;

    @Value("${milvus.dbName}")
    private String dbName;


    @Bean("milvusClientV2")
    public MilvusClientV2 milvusClientV2() {
        ConnectConfig build = ConnectConfig.builder()
                .uri(uri)
                .token(token)
                .dbName(dbName)
                .build();
        return new MilvusClientV2(build);
    }
}
